Skip to content

Conversation

yeswanth6096
Copy link
Contributor

@yeswanth6096 yeswanth6096 commented Aug 24, 2025

Added Dlpar_mem_hotplug Tescase

@yeswanth6096
Copy link
Contributor Author

@yeswanth6096 yeswanth6096 changed the title DRAFT - > Added Dlpar_mem_hotplug Tescase Added Dlpar_mem_hotplug Tescase Sep 9, 2025
Signed-off-by: yeswanth <[email protected]>
@yeswanth6096
Copy link
Contributor Author

Now fixed the 2nd reboot issue,

Added the support of multi reboot handle from common

OpTestInstallUtil.py
OpTestSOL.py (Handling exception)

Error-1

This code is getting error on 2nd reboot, This is the error -->

025-09-10 12:02:43,481:op-test.common.OpTestSSH:write:DEBUG:[console-expect]# 2025-09-10 12:02:43,549:op-test.common.OpTestHMC:write:DEBUG:r 2025-09-10 12:02:43,563:op-test.common.OpTestHMC:write:DEBUG:eboot 2025-09-10 12:02:43,637:op-test.common.OpTestHMC:write:DEBUG: 2025-09-10 12:02:43,637:op-test.common.OpTestHMC:write:DEBUG: 2025-09-10 12:02:43,866:op-test.common.OpTestHMC:write:DEBUG:Password: ^[[O2025-09-10 12:03:43,617:op-test.common.OpTestHMC:write:DEBUG:login: timed out after 60 seconds. >>>>>>>>>> Getting time out here 2025-09-10 12:03:43,668:op-test.common.OpTestSSH:write:DEBUG:cat /proc/cmdline 2025-09-10 12:03:43,669:op-test.common.OpTestSSH:write:DEBUG:BOOT_IMAGE=(ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000,msdos2)/vmlinuz-5.14.0-570.30.1.bz211063.el9.ppc64le root=/dev/mapper/rhel_ltczz219--lp7-root ro crashkernel=2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G rd.lvm.lv=rhel_ltczz219-lp7/root rd.lvm.lv=rhel_ltczz219-lp7/swap biosdevname=0 memory_hotplug.memmap_on_memory=0

Error-2
======== Log ====
025-09-10 12:05:15,243:op-test.common.OpTestSSH:write:DEBUG:grubby --update-kernel=grubby --default-kernel --remove-args="memory_hotplug.memmap_on_memory" --args="memory_hotplug.memmap_on_memory=force" 2025-09-10 12:05:15,391:op-test.common.OpTestSSH:write:DEBUG:[console-expect]# 2025-09-10 12:05:15,457:op-test.common.OpTestSSH:write:DEBUG:echo $? 2025-09-10 12:05:15,457:op-test.common.OpTestSSH:write:DEBUG:0 2025-09-10 12:05:15,457:op-test.common.OpTestSSH:write:DEBUG:[console-expect]# 2025-09-10 12:05:15,524:op-test.common.OpTestHMC:write:DEBUG:reboot. &gt;&gt;&gt;&gt; reboot not happening 2025-09-10 12:05:15,582:op-test.common.OpTestHMC:write:DEBUG: 2025-09-10 12:05:15,582:op-test.common.OpTestHMC:write:DEBUG: 2025-09-10 12:05:15,613:op-test.common.OpTestSSH:write:DEBUG:cat /proc/cmdline 2025-09-10 12:05:15,613:op-test.common.OpTestSSH:write:DEBUG:BOOT_IMAGE=(ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000,msdos2)/vmlinuz-5.14.0-570.30.1.bz211063.el9.ppc64le root=/dev/mapper/rhel_ltczz219--lp7-root ro crashkernel=2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G rd.lvm.lv=rhel_ltczz219-lp7/root rd.lvm.lv=rhel_ltczz219-lp7/swap biosdevname=0 memory_hotplug.memmap_on_memory=0 2025-09-10 12:05:15,614:op-test.common.OpTestSSH:write:DEBUG:[console-expect]# 2025-09-10 12:05:15,671:op-test.common.OpTestSSH:write:DEBUG:echo $? 2025-09-10 12:05:15,671:op-test.common.OpTestSSH:write:DEBUG:0 2025-09-10 12:05:15,671:op-test.common.OpTestSSH:write:DEBUG:[console-expect]# 2025-09-10 12:05:15,671:op-test.testcases.OpTestDlpar:runTest:DEBUG:Memory hotplug with setting: force 2025-09-10 12:05:15,671:op-test.testcases.OpTestDlpar:runTest:DEBUG:================= 2025-09-10 12:05:15,672:op-test.testcases.OpTestDlpar:AddRemove:DEBUG:Random number of memory generated for MEM is 30720 2025-09-10 12:05:15,672:op-test.testcases.OpTestDlpar:AddRemove:DEBUG:Loop is not on

code (common_utility)

if reboot and (req_args or req_remove_args):

Reboot the host for the kernel command to reflect

if reboot_cmd: raw_pty = self.cv_SYSTEM.console.get_console()
raw_pty.sendline("reboot") raw_pty.expect("login:", timeout=900)

After the first reboot, framework re-establishes console/SSH.

When try to reboot a 2nd time, self.cv_SYSTEM.console.get_console() is giving stale or HMC session, not the OS console.

So Adopt these changes in commonUtility

while reboot

1)Close stale console

2)Reopen it

3)Then reboot

Code changes to

if reboot and (req_args or req_remove_args):
if reboot_cmd:
# Always reopen console fresh to avoid stale session after first reboot
self.cv_SYSTEM.console.close() # <-- add this
raw_pty = self.cv_SYSTEM.console.get_console()

    raw_pty.sendline("reboot")
    login_patterns = [
        "login:", "root login:", "Ubuntu login:", "Password:",
    ]
    raw_pty.expect(login_patterns, timeout=900)

After changing the commonUtility hitting another issue

On 1st reboot getting warning log >>>>> Bad file descriptor Error below

with above changes -> [console-expect]#grubby --update-kernel=grubby --default-kernel --args="memory_hotplug.memmap_on_memory=0" grubby --update-kernel=grubby --default-kernel --args="memory_hotplug.memmap_on_memory=0" [console-expect]#echo $? echo $? 0 Exception in thread console: Traceback (most recent call last): File "/usr/lib64/python3.12/threading.py", line 1075, in _bootstrap_inner self.run() File "/root/yeswanth/op-test/common/OpTestSOL.py", line 71, in run self.nontimeout_run() File "/root/yeswanth/op-test/common/OpTestSOL.py", line 93, in nontimeout_run self.c.expect("\n", timeout=60) File "/root/yeswanth/op-test/common/OPexpect.py", line 87, in expect r = super(spawn, self).expect(patterns, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/pexpect/spawnbase.py", line 354, in expect return self.expect_list(compiled_pattern_list, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/pexpect/spawnbase.py", line 383, in expect_list return exp.expect_loop(timeout) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/pexpect/expect.py", line 169, in expect_loop incoming = spawn.read_nonblocking(spawn.maxread, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/pexpect/pty_spawn.py", line 501, in read_nonblocking return super(spawn, self).read_nonblocking(size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/pexpect/spawnbase.py", line 179, in read_nonblocking s = os.read(self.child_fd, size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 9] Bad file descriptor 2025-09-10 13:20:02,309:op-test.common.OpTestHMC:connect:INFO:De-activating the console rmvterm -m ltczz219 -p ltczz219-lp7-yashwanth rmvterm -m ltczz219 -p ltczz219-lp7-yashwanth Close command sent[console-expect]#echo $?

Before calling self.cv_SYSTEM.console.close() ,must stop the SOL reader thread cleanly

So added exception in OpTestSOL.py --> Done changes

@yeswanth6096
Copy link
Contributor Author

Latest Passlog -> 20250910193617344944.debug.log

Copy link

@vrbagalkot vrbagalkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra new line character
Please follow Class name convention
Make sure the variables have more meaning full name

# Reboot the host for the kernel command to reflect
if reboot_cmd:
# Always reopen console fresh to avoid stale session after first reboot
self.cv_SYSTEM.console.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below we are anyway opening new console, is it really required?

Also, when reboot is executed, all the consoles will become inactive anyway right?

raw_pty = self.cv_SYSTEM.console.get_console()
raw_pty.sendline("reboot")
raw_pty.expect("login:", timeout=900)
login_patterns = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you facing issues with only "login:" prompt?

Trying to understand why we need login_patterns. If its really needed, can you use re expression to match any prompt ending with login:

self.console.run_command("rm ./smt_script")


class Dlpar_mem_hotplug(OpTestDlpar, unittest.TestCase):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use standard convention of writing class name?
Something like this. DlparMemHotPlug or something similar.

from common.OpTestSOL import OpSOLMonitorThread
from common import OpTestInstallUtil
from common.OpTestUtil import OpTestUtil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove additional line

)
# Establish SSH connection
con = self.cv_SYSTEM.cv_HOST.get_ssh_connection()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all additional lines.

log.debug("=================")
# Add memory resource
self.AddRemove("mem", "-q", "a", self.mem_resource)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional lines

log.debug("=================")
# Remove memory resource
self.AddRemove("mem", "-q", "r", self.mem_resource)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove additional line


def runTest(self):
obj = OpTestInstallUtil.InstallUtil()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove additional line

super(Dlpar_mem_hotplug, self).setUp()

def runTest(self):
obj = OpTestInstallUtil.InstallUtil()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can obj be replaced with something more meaningful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants